<template>
  <div class="md-example-child md-example-child-field md-example-child-field-0">
    <div style="font-size: 30px;padding: 20px">订单详情</div>
    <md-field>
      <md-input-item title="姓名" v-model="order_detail.accept_name" is-title-latent ></md-input-item>
      <md-field-item solid title="状态" arrow :brief="order_detail.status_show" />
      <md-input-item title="所选号码" v-model="order_detail.telphone" is-title-latent ></md-input-item>
    </md-field>
    <div  style="width:100%;float:left;margin-top: 10px;margin-left: 0px;  padding: 0px;">
      <md-field style="min-height:320px;">
        <md-field-item solid title="联系电话" arrow :brief="order_detail.mobile" />
        <md-field-item solid title="订单编号" arrow :brief="order_detail.order_no" />
        <md-field-item solid title="收货地址" arrow :brief="order_detail.address_show" />
      </md-field>
    </div>
    <div  style="width:90%;margin-top: 10px;margin-left: 40px; padding: 0px;">
      <div  style="width:40%;font-size: 18px;float:left;margin-top: 10px;margin-left: 40px;  padding: 0px;">
        <md-button class="primary"  size="small" inline @click="go_home" >返回首页</md-button>
      </div>
    </div>
  </div>
</template>
<style lang="stylus">
.md-field-item .md-field-item-label.solid {
  width: 7.7rem
}
</style>
<script>
import { Popup, Button, InputItem, ActivityIndicator, Field, FieldItem, Icon } from 'mand-mobile'

// 2. 引入组件样式
import 'vant/lib/index.css'
import axios from 'axios'

export default {
  name: 'order-view',
  components: {
    [Popup.name]: Popup,
    [InputItem.name]: InputItem,
    [Button.name]: Button,
    [ActivityIndicator.name]: ActivityIndicator,
    [Field.name]: Field,
    [FieldItem.name]: FieldItem,
    [Icon.name]: Icon
  },
  data () {
    return {
      current: 1,
      items: [{name: 1, label: '标签1'}, {name: 2, label: '标签2'}],
      chosenAddressId: '1',
      finished: false,
      cert_name: '', // 姓名
      cert_no: '', // 身份证号码
      cert_num: '', // 自己电话，非购买的
      loading: false,
      open: false,
      url: {
        list: '/agentgetcity',
        agentorderdetail: '/agentorderdetail',
      },
      callback_url: '',
      order_detail: {
        accept_name: '',
        mobile: '',
        order_no: '',
        city_name: '',
        create_time: '',
        address: '',
        invoice_info: '',
        telphone: '',
        status_show: '处理中',
        address_show: ''
      }
    }
  },
  methods: {
    go_home () {
      this.$router.push({
        path: '/'
      })
    },
    go_order () {
      this.$router.push({
        path: '/content'
      })
    },
    onClick () {
      console.log(1)
    },
    getOrderDetail (id) {
      let param = {
        id
      }
      axios.post(this.url.agentorderdetail, param).then((r) => {
        console.log(r.data.data)
        if (r.data.data) {
          this.order_detail = r.data.data
          this.order_detail.address_show = this.order_detail.province_name + this.order_detail.city_name + this.order_detail.address
          this.order_detail.status_show = this.order_detail.status >= '1' && this.order_detail.status <= '2' ? '处理中' : '已完成'
          // console.log(this.allMobileListToShow)
        }
      })
    }
  },
  created () {
    let id = 0
    if (this.$route.query.id) {
      id = this.$route.query.id
    }
    this.getOrderDetail(id)
  }
}
</script>
